In IE, the star selector also selects comment tags. The behavior has changed through updates though, making it more dangerous in 1.2.3 (before, you had a valid element whose tag is "!"; now, you have a null element inside your collection).
<div class="test"> |
Selection result | Tag |
|---|---|---|
<p>That's a paragraph</p> |
Ignored | |
<div>That's a division</div> |
Ignored | |
<!-- That's a comment --> |
Ignored | |
<h3>That's a level 3 heading</h3> |
Ignored | |
</div>→ size of $$('test') = |
That's a paragraph
function updateDisplay(element) {
if (! element) {
$('!-result').set('text', 'null');
$('!-result-tag').set('text', 'Getting it would throw an error');
return;
}
var tag = element.get('tag');
$(tag + '-result').set('text', element);
$(tag + '-result-tag').set('text', tag);
}